<html data-layout-decorator="layout/form">
<div data-layout-fragment="content">
    <link rel="stylesheet" th:href="@{/assets/module/tagsInput/tagsInput.css}"/>
    <script type="text/javascript" th:src="@{/assets/module/tagsInput/tagsInput.js}"></script>
    <form class="layui-form model-form" action="">
        <input name="id" type="hidden" th:value="${info.id}?:0">
        <div class="layui-form-item">
            <label class="layui-form-label">职级名称：</label>
            <div class="layui-input-block">
                <input name="name" th:value="${info.name}" lay-verify="required" autocomplete="off"
                       placeholder="请输入职级名称" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态：</label>
            <div class="layui-input-block">
                <input name="status" id="status" th:value="${info.status}" lay-skin="switch" lay-filter="status"
                       lay-text="正常|停用" type="checkbox" th:checked="${info.status==2}?false:true">
                <script th:inline="javascript" type="text/javascript">
                    layui.use(['form'], function () {
                        var form = layui.form,
                            $ = layui.$;

                        if (1 == 1) {
                            $("#status").attr('type', 'hidden').val(1);
                        } else {
                            $("#status").attr('type', 'hidden').val(2);
                        }
                        form.on('switch(status)', function (data) {
                            console.log('switch开关选择状态：' + this.checked);
                            $(data.elem).attr('type', 'hidden').val(this.checked ? 1 : 2);
                        });
                    });
                </script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">显示顺序：</label>
            <div class="layui-input-block">
                <input name="sort" th:value="${info.sort}" lay-verify="required|number" autocomplete="off"
                       placeholder="请输入显示顺序" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item text-center model-form-footer">
            <button class="layui-btn" lay-filter="submitForm" lay-submit>立即保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">关闭</button>
        </div>
    </form>


</div>
</html>